package com.ibeeking.found.upms.s.rest.service;

import com.ibeeking.found.common.entity.CurrentUser;
import com.ibeeking.found.common.entity.LoginUserDTO;
import com.ibeeking.found.common.entity.UserInfoDTO;
import com.ibeeking.found.upms.api.common.query.AccountLoginQuery;
import com.ibeeking.found.upms.service.common.bo.ShopUserBO;
import com.ibeeking.found.upms.service.common.dos.ShopUserDO;
import com.ibeeking.found.upms.service.common.param.ModifyMobileParam;
import com.ibeeking.found.upms.service.common.param.ShopUserParam;
import com.ibeeking.found.upms.service.common.param.UserFindPwdParam;
import com.ibeeking.found.upms.service.common.param.UserModifyPwdParam;
import com.ibeeking.found.upms.service.common.query.ShopUserPageQuery;
import com.ibeeking.found.upms.service.common.vo.ChoiceShopVO;
import com.ibeeking.found.upms.service.common.vo.CurrentUserVO;
import com.ibeeking.found.upms.service.common.vo.ShopUserPageVO;
import com.ibeeking.found.upms.service.common.vo.ShopUserVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Author ibeeking
 */
public interface IShopUserService {

    /**
     * 商户用户分页
     *
     * @param shopId
     * @param query
     * @return
     */
    Page<ShopUserPageVO> pageList(Long shopId, ShopUserPageQuery query);

    /**
     * 新增商户用户
     *
     * @param param
     * @return
     */
    Boolean add(Long shopId, ShopUserParam param);

    /**
     * 修改商户用户
     *
     * @param param
     * @return
     */
    Boolean modify(ShopUserParam param);

    /**
     * 修改所有商户用户信息
     *
     * @param tenantIds
     * @param shopUserDO
     * @return
     */
    Boolean updateAllById(List<Integer> tenantIds, ShopUserDO shopUserDO);

    /**
     * 查看商户用户信息
     *
     * @param id
     * @return
     */
    ShopUserVO view(Long id);

    ShopUserBO queryById(Long id);

    /**
     * 解锁/锁定商户账号
     *
     * @param shopId
     * @param id
     * @param status
     * @return
     */
    Boolean changeStatus(Long shopId, Long id, Integer status);

    /**
     * 是否是管理员
     *
     * @param userId
     * @return
     */
    Boolean isAdministrator(Long shopId, Long userId);

    /**
     * 删除商户用户
     *
     * @param id
     * @return
     */
    Boolean del(Long shopId, Long id);

    /**
     * 修改商户用户密码
     *
     * @param userModifyPwdParam
     * @return
     */
    Boolean modifyPwd(Long userId, UserModifyPwdParam userModifyPwdParam);

    /**
     * 修改用户密码
     *
     * @param userId
     * @param newPassword
     * @return
     */
    Boolean modifyPassword(Long userId, String newPassword);

    /**
     * 重置商户用户密码
     *
     * @param id
     * @return
     */
    Boolean resetPwd(Long id);

    /**
     * 找回商户用户密码
     *
     * @param userFindPwdParam
     * @return
     */
    Boolean findPwd(UserFindPwdParam userFindPwdParam);


    /**
     * 用户管辖店铺列表
     *
     * @param currentUser
     * @return
     */
    List<ChoiceShopVO> shops(CurrentUser currentUser);

    /**
     * 登录查询
     *
     * @param query
     * @return
     */
    LoginUserDTO queryAccountLogin(AccountLoginQuery query);

    /**
     * 查询所属店铺id
     *
     * @param userId
     * @return
     */
    List<Long> queryShopIds(Long userId);

    /**
     * 登录信息查询
     *
     * @param request
     * @param userId
     * @return
     */
    UserInfoDTO queryLoginUser(HttpServletRequest request, Long userId);

    /**
     * 注销商户账号
     *
     * @param shopId
     * @param userId
     * @return
     */
    Boolean logOff(Long shopId, Long userId);

    Boolean modifyMobile(CurrentUser currentUser, ModifyMobileParam param);

    Boolean quit(Long shopId, Long userId);

    CurrentUserVO currentInfo(Long userId);
}
